-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring: use tmp path fixture to mock remote and local for transport plugins #6627
Refactoring: use tmp path fixture to mock remote and local for transport plugins #6627
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6627 +/- ##
==========================================
+ Coverage 77.51% 77.89% +0.38%
==========================================
Files 560 567 +7
Lines 41444 42180 +736
==========================================
+ Hits 32120 32850 +730
- Misses 9324 9330 +6 ☔ View full report in Codecov by Sentry. |
aeb255f
to
77e0074
Compare
58b1668
to
f19067c
Compare
f2c9064
to
db72976
Compare
56527c6
to
f9bfea9
Compare
for more information, see https://pre-commit.ci
When running tests, I got a lot resource not clean warnings which may indicate some resource leak:
This require some investigation. |
a0c5056
to
3c1a702
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @unkcpz ,
Thanks a lot! I think this PR is useful.
tests/transports/test_all_plugins.py
Outdated
def test_put_get_abs_path_file(custom_transport): | ||
def test_put_get_abs_path_file(custom_transport, tmp_path_factory): | ||
"""Test of exception for non existing files and abs path""" | ||
local_dir = os.path.join('/', 'tmp') | ||
remote_dir = local_dir | ||
local_dir = tmp_path_factory.mktemp('local') | ||
remote_dir = tmp_path_factory.mktemp('remote') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be consistence, can you also define local_tmp_path
fixture?
Because now, in some tests only use remote_tmp_path
, some other directly uses tmp_path_factory
..
Either that, or I suggest just remove that remote_tmp_path
fixture and always to use tmp_path
tests/transports/test_all_plugins.py
Outdated
|
||
|
||
def test_exec_pwd(custom_transport): | ||
def test_exec_pwd(custom_transport, remote_tmp_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep the previous pwd
and instead make it exclusive to core.ssh
& core.auto_ssh
& core.local
.
This test would not make sense for plugins without getcwd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugins without getcwd
what you mean by plugins without getcwd? I think ssh/auto_ssh/local all has this method implemented, no?
This PR require the change in #6639 to not fail the mypy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @khsrali for review! I think I address all your comments.
cc051b4
to
f4de64d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @unkcpz , just a few more adjustments.. then I think would be good to go
Thanks @khsrali, I addressed the comments you mentioned, and improve a test to make sure the |
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
8f120ac
to
cd035ad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @unkcpz , LGTM!
These are changes required by #6620, and some changes are overlap with changes in #6626. The changes are focus on following two purposes:
chdir
andgetcwd
methods.tmp_path
andtmp_path_factory
fixtures to mock remote and local folder to test transport plugins.The change make every test has its own tmp folder therefore can run independent.